package com.ec.bl.controller;

import com.ec.bl.domain.vo.*;
import com.ec.bl.service.DashboardService;
import com.ec.common.domain.Result; // 假设你有这样一个通用的返回结果类

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/dashboard")
@RequiredArgsConstructor
public class DashboardController {

    private final DashboardService dashboardService;

    @GetMapping("/metrics")
    public Result<DashboardMetricsVO> getDashboardMetrics() {
        return Result.ok(dashboardService.getDashboardMetrics());
    }

    @GetMapping("/tasks/appointments")
    public Result<List<PendingTaskVO>> getPendingAppointments() {
        return Result.ok(dashboardService.getPendingAppointments());
    }

    @GetMapping("/tasks/applications")
    public Result<List<PendingTaskVO>> getPendingApplications() {
        return Result.ok(dashboardService.getPendingApplications());
    }

    @GetMapping("/tasks/feedback")
    public Result<List<RecentFeedbackVO>> getLatestFeedback() {
        return Result.ok(dashboardService.getLatestFeedback());
    }

    @GetMapping("/alerts/health")
    public Result<List<HealthAlertVO>> getRealtimeHealthAlerts() {
        return Result.ok(dashboardService.getRealtimeHealthAlerts());
    }

    @GetMapping("/charts/trends")
    public Result<TrendsChartVO> getCheckInTrends() {
        return Result.ok(dashboardService.getCheckInTrends());
    }
}